<html>
  <head>
    <title><g:layoutTitle default="Youtube TV" /></title>
    <link rel="stylesheet" href="${resource(dir:'css',file:'main.css')}" />
    <g:layoutHead />
    <g:socialLoginScript/>
    <script type="text/javascript">
      var _gaq = _gaq || [];
      _gaq.push(['_setAccount', 'UA-27160376-1']);
      _gaq.push(['_trackPageview']);

      (function () {
        var ga = document.createElement('script');
        ga.type = 'text/javascript';
        ga.async = true;
        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
        var s = document.getElementsByTagName('script')[0];
        s.parentNode.insertBefore(ga, s);
      })();
    </script>
  </head>
  <body onload="${pageProperty(name:'body.onload')}">
    <div id="categorized-video">
      <div id="site-header">
        <%-- img src="${resource(dir:'images',file:'tv.png')}"/ --%>
        <span class="logo">TV youtube</span>
        <span class="message message1">watch youtube continuously</span>
        <span class="message message2">watch youtube nonstop</span>
        <span class="message message3">Check used car pricing analytics at <a href="http://www.carbestprices.com/">Car Best Prices</a></span>
      </div>
      <div id="login">
        <gae:loginLogout reqUri='/' />
      </div>
      <div id="content">
        <g:layoutBody />
        <div class="tag-cloud">
          <g:each var="videoCategory" in="${videoCategories}">
            <a ${videoCategory == currentVideoCategory ? "class='current-video-category'" : ''}
               href="/videoCategory/index/${videoCategory.feed}/${videoCategory.time}"
              ><g:message code="${videoCategory.feed.replaceAll('/', '.')}.${videoCategory.time}"/></a>
          </g:each>
          <br/><br/>
          <g:set var="userService" value="${com.google.appengine.api.users.UserServiceFactory.userService}"/>
          <g:set var="user" value="${userService.currentUser}"/>
          <g:if test="${user}">
            <g:checkBox name="avoidDuplicates" value="${params.avoidDuplicates}" onclick="avoidDuplicatesChanged()"/>
          </g:if>
          <g:else>
            <input type="checkbox" name="avoidDuplicates" id="avoidDuplicates" value="true"
                   onclick="document.location='${userService.createLoginURL(request.forwardURI + '?avoidDuplicates=true')}'"/>
          </g:else>
          <label for="avoidDuplicates">Skip videos which I watched this week (login required)</label>
          <br/><br/>
          <g:render template="/common/socialButtons"/>
        </div>
      </div>
    </div>
  </body>
</html>